package cloud.seri.iot.aliyun.client

import org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor
import org.springframework.context.annotation.Bean
import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext

import feign.RequestInterceptor
import io.github.jhipster.security.uaa.LoadBalancedResourceDetails

class OAuth2InterceptedFeignConfiguration(private val loadBalancedResourceDetails: LoadBalancedResourceDetails) {

    @Bean(name = ["oauth2RequestInterceptor"])
    fun getOAuth2RequestInterceptor(): RequestInterceptor {
        return OAuth2FeignRequestInterceptor(DefaultOAuth2ClientContext(), loadBalancedResourceDetails)
    }
}
